home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 630 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.1 KB

  1. Path: chronicle.mti.sgi.com!austern
  2. From: tim@franck.Princeton.EDU (Tim Hollebeek)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Single-line comment and line continuation
  5. Date: 05 Mar 1996 09:41:20 PST
  6. Organization: Princeton University
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <4hgbpd$1pl@cnn.Princeton.EDU>
  9. References: <313B3175.331A@strata3d.com> <4hffkm$3f0@engnews1.Eng.Sun.COM>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. X-Original-Date: 5 Mar 1996 03:18:05 GMT
  12. X-Newsreader: TIN [version 1.2 PL2]
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBVAwUBMTx80Uy4NqrwXLNJAQFgWwH+IfWwJOF8iCkijHePQaoeC0/FnL4h3wfL
  15.     ZEyqEzYpesxeYm3fMBFgR15wWCH/Bbsf/no0nCLZytDtNz9I/pFnOg==
  16.     =vWpx
  17. Originator: austern@isolde.mti.sgi.com
  18.  
  19. Steve Clamage (clamage@Eng.Sun.COM) wrote:
  20. : >I just ran across something in my C++ compiler dealing with single line 
  21. : >comments and the line continuation token:
  22. : >
  23. : > if ((ch[0] == '\\') && (ch[1] == '\\'))  //look for initial \\
  24. : >
  25. : >This, under my compiler implementation will choke because of the line 
  26. : >continuation token, '\' at the end of the comment.
  27.  
  28. : In C++, simply don't use '//' comments on any line that ends with an
  29. : escaped newline (including macro definitions!). In your example, it would
  30. : make the comment more readable IMHO if you put the '\\' in quotes anyway,
  31. : and would eliminate the problem.
  32.  
  33. Or simply add a single space after the last \, and take advantage of
  34. that annoying behavior for once :-)
  35.  
  36. ---------------------------------------------------------------------------
  37. Tim Hollebeek         | Disclaimer :=> Everything above is a true statement,
  38. Electron Psychologist |                for sufficiently false values of true.
  39. Princeton University  | email: tim@wfn-shop.princeton.edu
  40. ----------------------| http://wfn-shop.princeton.edu/~tim (NEW! IMPROVED!)
  41. ---
  42. [ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
  43.                 newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  44.   comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  45.   Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  46.   Comments? mailto:std-c++-request@ncar.ucar.edu 
  47. ]
  48.